﻿using System;
using System.Linq;

namespace MinesweeperUtility
{
    public class Difficulty : IDraw
    {
        private Level level;
        private int rows;
        private int cols;
        private int numberOfBombs;

        public Difficulty(Level level)
        {
            this.level = level;
            switch (level)
            {
                case Level.Beginner:
                    this.rows = 9;
                    this.cols = 9;
                    this.numberOfBombs = 10;
                    Console.WindowWidth = 35;
                    Console.BufferWidth = 35;
                    Console.WindowHeight = 27;
                    Console.BufferHeight = 27;
                    break;
                case Level.Intermediate:
                    this.rows = 16;
                    this.cols = 16;
                    this.numberOfBombs = 40;
                    Console.WindowWidth = 55;
                    Console.BufferWidth = 55;
                    Console.WindowHeight = 41;
                    Console.BufferHeight = 41;
                    break;
                case Level.Expert:
                    this.rows = 16;
                    this.cols = 30;
                    this.numberOfBombs = 99;
                    Console.WindowWidth = 95;
                    Console.BufferWidth = 95;
                    Console.WindowHeight = 41;
                    Console.BufferHeight = 41;
                    break;
                default:
                    throw new ArgumentException("Incorrect level!!!");
            }
        }

        public int Rows
        {
            get { return this.rows; }
            set { this.rows = value; }
        }

        public int Cols
        {
            get { return this.cols; }
            set { this.cols = value; }
        }

        public int NumberOfBombs
        {
            get { return this.numberOfBombs; }
            set { this.numberOfBombs = value; }
        }

        public Level Level
        {
            get { return this.level; }
            set { this.level = value; }
        }

        public void Draw(int x, int y)
        {
            Console.SetCursorPosition(x, y);
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("     Level: {0} Mines: {1}\n", this.Level, this.NumberOfBombs);
        }
    }
}